<template>
  <div class="work-bench-layout">
    <el-row style="width: 100%">
      <el-col :span="6">
        <el-card>
          <div class="app-todo" @click="jump(1)">
            <el-row>
              <el-col :span="12" class="mt-icon">
                <el-icon>
                  <ele-Bell color="#1890ff"/>
                </el-icon>
              </el-col>
              <el-col :span="12">
                <div class="mt-title">我的待办</div>
                <div class="mt-value">{{ todoNum }}</div>
              </el-col>
            </el-row>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18">
        <el-card>
          <el-row>
            <el-col :span="6">
              <div class="app-task" @click="jump(2)">
                <div class="app-task-icon">
                  <el-icon class="mr5">
                    <ele-FolderAdd color="#1890ff"/>
                  </el-icon>
                </div>
                <span class="app-task-title">我发起的</span>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="app-task"  @click="jump(3)">
                <div class="app-task-icon">
                  <el-icon class="mr5">
                    <ele-Checked color="#1890ff"/>
                  </el-icon>
                </div>
                <span class="app-task-title">我处理的</span>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="app-task"  @click="jump(4)">
                <div class="app-task-icon">
                  <el-icon class="mr5">
                    <ele-SoldOut color="#1890ff"/>
                  </el-icon>
                </div>
                <span class="app-task-title">抄送我的</span>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="app-task">
                <div class="app-task-icon">
                  <el-icon class="mr5">
                    <ele-Bell color="#1890ff"/>
                  </el-icon>
                </div>
                <span class="app-task-title">我的草稿</span>
              </div>
            </el-col>
          </el-row>
        </el-card>
      </el-col>
    </el-row>
    <el-row style="width: 100%" class="flow-manage">
      <el-card style="width: 100%">
        <template #header>
          <div class="card-header">
            <span>流程业务模块</span>
          </div>
        </template>
        <div>
          <el-row style="width: 100%;height: calc(100vh - 360px);overflow-y: auto">
            <el-col :span="6" v-for="(item,index) in routerList" :key="index" style="padding-left: 8px;padding-right: 8px;padding-bottom: 16px;">
              <div class="card-in" @click="() => {router.push({path: item.routerUrl})}">
                <div class="flow-icon">
                  <img src="
                  GdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURf///zKW+ur0/nO4+6XR/YvE/Eqi+5DG/Nnr/sPg
                  /brnfYAAAAFMSURBVFjD7dfPSsNAEAbwNTGtuXVM09pbqCAeFV8gwYNXtU+wioI3FcFrLorH+OeBncYuSnYl
                  +wUKEueDNmHhR8rO7myqqGOUQIECBQoUaDK5dsQD3ihXNtth6YTqtQ0mbqcGbXD8C4z6BYPFUSP3ftCawOVU+8ANe
                  zH5QXuVzDwnJ5g38nfruP/SSOYHh9bkjNdcjrDrAghOHhvJe7ettlab6RaFA9fDkTpOURivbi963OX+H/x4qLrA4I
                  zHzjvA57pzVDCMsU7+nT0eKfiTofCQKF2SAxAGPLBdf4GQz63LXB1rHsVgRDtfD05BGLKofQJDOuXLHQyHdQm5mOhP
                  jQ2coXXUXIiM6zFCYUGj3aTUlKMwpIQPOd9j7ufS0abDotsqMu+wcAd40nRV+sCp1W0ysxbW9GpNlRsWrTB9mzvyLn
                  /KBAoUKFCgyScZMYmWkzKSDQAAAABJRU5ErkJggg==" width="60">
                </div>
                <div class="ant-space ant-space-vertical" style="gap: 8px;">
                  <div class="ant-space-item" style="">
                    <div class="first-edit"><strong><span>{{ item.processName }}</span><!----></strong><!----></div>
                  </div>
                  <div class="ant-space-item" style="">
<!--                    <div>2022-11-27 01:04:49</div>-->
                  </div>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </el-card>
    </el-row>
  </div>
</template>

<script lang="ts" setup name="workBench">
import { defineAsyncComponent, ref, reactive, onMounted, nextTick, computed, watch } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
const router = useRouter();
const todoNum = ref(0);
const routerList = ref([]);

const init = ()=> {
  $api.common.send.post('flowLongDeploy006', {businessScope: 1}).then((res) => {
    const data = res.result
    todoNum.value = data.todoNum
    routerList.value = data.routerList
  }).catch(() => {});
}

const jump = (jumpNo) => {
  switch (jumpNo) {
    case 1:
      router.push({path: "/system/workflow/todoList"})
      break;
    case 2:
      router.push({path: "/system/workflow/startList"})
      break;
    case 3:
      router.push({path: "/system/workflow/hasAuditList"})
      break;
    case 4:
      router.push({path: "/system/workflow/copyToMe"})
      break;
  }
}

onMounted(() => {
  nextTick(() => {
    init();
  });
});
</script>

<style scoped lang="less">
.work-bench-layout {
  padding: 10px;
  width: 100%;
}

.app-todo {
  cursor: pointer;
  border-radius: 4px;
  box-shadow: none; /* 初始化为无阴影 */
  transition: box-shadow 0.3s ease; /* 平滑过渡阴影变化 */

  &:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* 鼠标悬浮时显示阴影 */
  }

  .mt-icon {
    text-align: center;
    line-height: 80px;
    font-size: 42px;
  }

  .mt-title {
    font-size: 18px;
    padding: 10px 0 0;
  }

  .mt-value {
    font-size: 32px;
    font-weight: 700;
  }
}

.app-task {
  cursor: pointer;
  border-radius: 10px;
  text-align: center;
  padding: 0 0 10px;

  &:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* 鼠标悬浮时显示阴影 */
  }

  .app-task-icon {
    font-size: 32px;
    margin-bottom: 4px;
  }

  .app-task-title {
    font-size: 16px;
  }
}

.flow-manage {
  .card-header {
    font-size: 16px;
    padding-left: 10px;
  }
  .card-in {
    height: 100px;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: row;
    width: 100%;
    border: 1px solid #d9d9d9;
    background: var(--component-background);
    cursor: pointer;
    transition: border-color 0.3s; /* 平滑过渡边框颜色 */
    >div:nth-child(1) {
      flex: 0 0 66px;
    }
    img {
      height: 100%;
    }
    &:hover {
      border-color: #2e2ee2; /* 鼠标悬浮时的边框颜色 */
    }
  }

}

</style>